from typing import *


class Solution:
    def temperatureTrend(self, temperatureA: List[int], temperatureB: List[int]) -> int:
        l, ans = 0, 0
        for i in range(1, len(temperatureA)):
            a, b = temperatureA[i], temperatureB[i]
            c, d = temperatureA[i - 1], temperatureB[i - 1]
            if a > c and b > d or a < c and b < d or a == c and b == d:
                ans = max(ans, i - l)
            else:
                l = i
        return ans
